/**************************************************************************************
*
*	Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	EffectsLibrary.h
*
*	Description -	This is just a wrapper to load sets of effects to be used and links
*					the render techniques to the effects.
*
*	Comments	-	This class was made to pre-load all the default effect files and 
*					shaders registered in the renderer's initialization. The library
*					also stores the effect id for each of the effect for easily
*					managing assigned IDs for the effects.
*					
*	Modification History:
*			Name			   Date					Description
*			MrCodeSushi	-	10/08/2012	-	Creation of this file
**************************************************************************************/
#ifndef _PSX_EFFECTS_LIBRARY_H_
#define _PSX_EFFECTS_LIBRARY_H_

#include "PulseSTD.h"
#include "Effect.h"
#include "RenderTechnique.h"
#include "Shader.h"
#include "Array.h"
#include "Map.h"

namespace Pulse
{
	class EffectsLibrary
	{
	public:

		EffectsLibrary( void );

		~EffectsLibrary( void );

		BOOL Load( const CHAR *pEffectsLibrary, const CHAR *pRenderTechLibrary );

	private:

		BOOL LoadEffectsLibrary( const CHAR *pLibraryFile );

		BOOL LoadRenderTechniquesLibaray( const CHAR *pLibraryFile );

		void Cleanup( void );

		void RegisterTechniquesToEffects( void );

	private:

		EErrorCode::Type ProcessEffects( XMLElementPtr pElem );

		EErrorCode::Type ProcessRenderTechniques( XMLElementPtr pElem );

	private:

		typedef Array<Effect*> EffectList;
		typedef Array<RenderTechnique*> RenderTechniqueList;
		typedef Map<EffectID, Effect*> EffectsMap;

		EffectList			m_effects;
		RenderTechniqueList m_renderTechnqiues;
		EffectsMap			m_effectsMap;
	};
}

#endif /* _PSX_EFFECTS_LIBRARY_H_ */